package com.awphone.data;

import com.awphone.data.constant.EObjectType;
import com.awphone.data.constant.StreetConst;

import javax.persistence.*;

/**
 * @author a_polyakov
 * Date: 03.03.13
 * Time: 22:35
 * Улица
 */
@Entity
@Table(schema = StreetConst.SCHEMA_NAME, name = StreetConst.TABLE_NAME)
public class Street extends AbstractObject {
    /**
     * Город
     */
    private City city;
    /**
     * Наименование
     */
    private String name;

    {
        setObjectType(EObjectType.STREET);
    }

    public Street() {
    }

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = StreetConst.S_CITY, nullable = false, updatable = false)
    public City getCity() {
        return city;
    }

    public void setCity(City city) {
        this.city = city;
    }

    @Column(name = StreetConst.S_NAME, nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
